package control;

import java.io.IOException;

import javax.portlet.*;

import security.SecuritySimulator;

import form.BaseForm;
import form.LoginForm;

public class Login extends BaseControl {
	public LoginForm procLogin(ActionRequest request, ActionResponse response)
			throws PortletException, IOException {
		LOG.debug("procLogin.START");
		String user = request.getParameter("loginUsername");
		String pass = request.getParameter("loginPassword");
		SecuritySimulator ss = new SecuritySimulator();
		LoginForm result = new LoginForm();
		if (user == "" || pass == "")
			return result;
		result.setRole(ss.getRole(user, pass));
		result.setLoginUsername(user);
		result.setLoginPassword(pass);
		if(result.getRole() == -1)
			LOG.debug("procLogin.FAIL");
		LOG.debug("procLogin.END");
		return result;
	}

	public BaseForm procBack(ActionRequest request, ActionResponse response)
			throws PortletException, IOException {
		LOG.debug("procBack.START");
		LOG.debug("procBack.START");
		return null;
	}
}
